package simulateOS.entity;

import javafx.scene.AccessibleAttribute;
import javafx.scene.control.Skin;
import javafx.scene.control.TableRow;

/**
 * Description：更改TableView的行属性
 * <p>Date: 2022/11/5
 * <p>Time: 23:11
 *
 * @Author SillyBaka
 **/
public class MyTableRow extends TableRow<Process> {

    @Override
    public void updateSelected(boolean selected) {
        super.updateSelected(selected);

        Process item = getItem();
        if(item != null){
            if(item.getStatus() == Status.READY){
                this.setStyle(null);
            }
            if(item.getStatus() == Status.RUN){
                this.setStyle("-fx-background-color: pink");
            }
            if(item.getStatus() == Status.WAIT){
                this.setStyle("-fx-background-color: yellow");
            }
            if(item.getStatus() == Status.BLOCK){
                this.setStyle(null);
            }
        }else {
            this.setStyle(null);
        }
    }
}

